Partitioner(TSource) Class

Task Parallel System.Threading

Represents a particular manner of splitting a data source into multiple partitions.

Namespace:  System.Collections.Concurrent
Assembly:  System.Threading (in System.Threading.dll)

Syntax

Visual Basic (Declaration)
<HostProtectionAttribute(SecurityAction.LinkDemand, Synchronization := True,  _
	ExternalThreading := True)> _
Public MustInherit Class Partitioner(Of TSource)
C#
[HostProtectionAttribute(SecurityAction.LinkDemand, Synchronization = true, 
	ExternalThreading = true)]
public abstract class Partitioner<TSource>

Type Parameters

TSource
Type of the elements in the collection.

Remarks

Inheritors of Partitioner<(Of <(TSource>)>) must adhere to the following rules:

  1. GetPartitions(Int32) should throw a ArgumentOutOfRangeException if the requested partition count is less than or equal to zero.
  2. GetPartitions(Int32) should always return a number of enumerables equal to the requested partition count. If the partitioner runs out of data and cannot create as many partitions as requested, an empty enumerator should be returned for each of the remaining partitions. If this rule is not followed, consumers of the implementation may throw a InvalidOperationException.
  3. GetPartitions(Int32) and GetDynamicPartitions()()() should never return null. If null is returned, a consumer of the implementation may throw a InvalidOperationException.
  4. GetPartitions(Int32) and GetDynamicPartitions()()() should always return partitions that can fully and uniquely enumerate the input data source. All of the data and only the data contained in the input source should be enumerated, with no duplication that was not already in the input, unless specifically required by the particular partitioner's design. If this is not followed, the output ordering may be scrambled.

Inheritance Hierarchy

System..::.Object
  System.Collections.Concurrent..::.Partitioner<(Of <(TSource>)>)
    System.Collections.Concurrent..::.OrderablePartitioner<(Of <(TSource>)>)

See Also